package amqp.tutorials.all.header;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;

/**
 * 消息接收者
 */
@Service
@Slf4j
public class HeadReceiver {

    @RabbitListener(queues = "queue_header01")
    public void queue_header1(Message message) {
        log.info("queue_header01 接收消息 message 对象" + message);
        log.info("queue_header01 接收消息" + new String(message.getBody()));
    }

    @RabbitListener(queues = "queue_header02")
    public void queue_header2(Message message) {
        log.info("queue_header2 接收消息 message 对象" + message);
        log.info("queue_header2 接收消息" + new String(message.getBody()));
    }
}
